<?php
namespace app\model;


use Illuminate\Database\Eloquent\Relations\HasOne;

class OrderModel extends BaseModel{

    protected $table = 'rl_orders';

    //关联详情
    public function orderDetails(): HasOne
    {
        return $this->hasOne('app\model\OrderDetailsModel','order_id','id')->where('status',1);
    }

    //关联集合信息
    public function assemblyDetails(): HasOne
    {
        return $this->hasOne('app\model\AssemblyLocationModel','id','assembly_location_id');
    }

    public function getJoinMemberNumsAttribute($value)
    {
        return $value?json_decode($value,true):[];
    }

    public function getCreateTimeAttribute($value): int
    {
        return (int)$value;
    }

    public function getUpdateTimeAttribute($value): int
    {
        return (int)$value;
    }

}